package com.qwc.blog.entity.vo.user;

import com.qwc.blog.entity.User;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * @author qwc
 * @Date 2021/10/26 15:48
 */
@Data
public class AddUserDto extends PutProfileDto {
    @NotBlank(message = "账号不能为空")
    private String username;
    @NotBlank(message = "密码不能为空")
    private String password;
    @NotBlank(message = "状态不能为空")
    private String status;
    private String introduction;

    public User createUser() {
        User user = new User();
        user.setUsername(this.username);
        user.setPassword(this.password);
        user.setNickname(super.getNickname());
        user.setSex(super.getSex());
        user.setPhoneNumber(super.getPhoneNumber());
        user.setEmail(super.getEmail());
        user.setStatus(this.status);
        user.setIntroduction(introduction);
        return user;
    }
}
